import httpx
import requests
from PIL import Image
from io import BytesIO
# r = requests.get('https://baidu.com')
# h = httpx.get('https://baidu.com')
# h = httpx.get('https://httpbin.org/get')
# r = httpx.post('https://httpbin.org/post', data={'key': 'value'})
# r = httpx.get('https://www.example.org/')
# client = httpx.Client()
# r.encoding = 'ISO-8859-1'
# print(r.text)
# print(r.content)
# i = Image.open(BytesIO(r.content))
# print(i)
# print(h)
# import tempfile
#
# import httpx
# from tqdm import tqdm
#
# with tempfile.NamedTemporaryFile() as download_file:
#     url = "https://speed.hetzner.de/100MB.bin"
#     with httpx.stream("GET", url) as response:
#         total = int(response.headers["Content-Length"])
#
#         with tqdm(total=total, unit_scale=True, unit_divisor=1024, unit="B") as progress:
#             num_bytes_downloaded = response.num_bytes_downloaded
#             for chunk in response.iter_bytes():
#                 download_file.write(chunk)
#                 progress.update(response.num_bytes_downloaded - num_bytes_downloaded)
#                 num_bytes_downloaded = response.num_bytes_downloaded
import asyncio
import httpx


async def main():
    async with httpx.AsyncClient() as client:
        response = await client.get('https://www.example.com/')
        print(response)


asyncio.run(main())
